function [V_dct_Vec,varargout]=FunApp_StateReduction_DCT(V,Size,ResPct)

%% Preliminaries
N_Dim   =   length(Size);
if ~isvector(V)
    error('Please input an vector');
end
if numel(V)~=prod(Size)
    error('Dimension is not consistent');
end
if N_Dim>1
    V_Mat   =   reshape(V,Size);
end

if nargin>2 && (ResPct>1 || ResPct<=0)
    error('Post-Compression Ratio has to be in (0,1]');
end
%% dct along each Dimension
for ii=1:N_Dim
    if ii==1
        V_dct_Mat   =   dct(V_Mat,[],ii);
    else
        V_dct_Mat   =   dct(V_dct_Mat,[],ii);
    end
end
V_dct_Vec       =   V_dct_Mat(:);

if nargin>2
    [~,Ind]     =   sort(abs(V_dct_Vec),'descend');
    NumCoef     =   1;
    VecNorm     =   norm(V_dct_Vec);
    while norm(V_dct_Vec(Ind(1:NumCoef)))/VecNorm<ResPct
        NumCoef = NumCoef+1;
    end
    
    Ind_Res     =   find(abs(V_dct_Vec)>=abs(V_dct_Vec(Ind(NumCoef))));
    varargout{1}=   Ind_Res;
end